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U6ICfmrYzmiYsm5puy5bqTJywKICAgIGNsYXNzX3VybDogJ3NpbmdlciZzb25nJywKICAgIOS4gOe6pzogJGpzLnRvU3RyaW5nKCgpID0+IHsKICAgICAgICBsZXQgZCA9IFtdOwogICAgICAgIC8vIGxldCBfdXJsID0gaW5wdXQuc3BsaXQoJyMnKVswXTsKICAgICAgICBsZXQgX3VybCA9IHJ1bGUucm9vdDsKICAgICAgICBsZXQgcGFyYW1zID0gW107CiAgICAgICAgbGV0IHNxbCA9ICcnOwogICAgICAgIGxldCBzaXplID0gMjA7CiAgICAgICAgbGV0IHBnID0gTVlfUEFHRTsKICAgICAgICBpZiAoTVlfQ0FURSA9PT0gJ3NpbmdlcicpIHsKICAgICAgICAgICAgc3FsID0gJ3NlbGVjdCBuYW1lLCBpZCBmcm9tIHNpbmdlciB3aGVyZSAxPTEnOwogICAgICAgICAgICBpZiAoTVlfRkwucmVnaW9uKSB7CiAgICAgICAgICAgICAgICBwYXJhbXMucHVzaChNWV9GTC5yZWdpb24pOwogICAgICAgICAgICAgICAgc3FsICs9ICcgYW5kIHJlZ2lvbl9pZCA9ID8nOwogICAgICAgICAgICAgICAgLy8gX3VybCArPSAnJndoZXJlPXJlZ2lvbl9pZCZrZXl3b3Jkcz0nICsgTVlfRkwucmVnaW9uICsgJyZzaXplPTIxJzsKICAgICAgICAgICAgfSBlbHNlIGlmIChNWV9GTC5mb3JtKSB7CiAgICAgICAgICAgICAgICBwYXJhbXMucHVzaChNWV9GTC5mb3JtKTsKICAgICAgICAgICAgICAgIHNxbCArPSAnIGFuZCBmb3JtX2lkID0gPyc7CiAgICAgICAgICAgICAgICAvLyBfdXJsICs9ICcmd2hlcmU9Zm9ybV9pZCZrZXl3b3Jkcz0nICsgTVlfRkwuZm9ybSArICcmc2l6ZT0yMSc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc3FsICs9IGAgb3JkZXIgYnkgaWQgbGltaXQgJHsocGcgLSAxKSAqIHNpemV9LCR7c2l6ZX07YDsKICAgICAgICAgICAgbGV0IGh0bWwgPSBwb3N0MihfdXJsLCB7cGFyYW1zOiBwYXJhbXMsIHNxbDogc3FsfSk7CiAgICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShodG1sKTsKICAgICAgICAgICAgZCA9IGpzb24ucmVzdWx0WzBdLnJlc3VsdHMubWFwKGl0ZW0gPT4gewogICAgICAgICAgICAgICAgbGV0IHBpYyA9IHJ1bGUubWt0dlVybCArIGl0ZW0uaWQgKyAnLmpwZyc7CiAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgIHZvZF9pZDogaXRlbS5uYW1lICsgJ0BAJyArIGl0ZW0ubmFtZSArICdAQCcgKyBwaWMsCiAgICAgICAgICAgICAgICAgICAgdm9kX25hbWU6IGl0ZW0ubmFtZSwKICAgICAgICAgICAgICAgICAgICB2b2RfcGljOiBwaWMsCiAgICAgICAgICAgICAgICAgICAgdm9kX3JlbWFya3M6ICcnLAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9IGVsc2UgaWYgKE1ZX0NBVEUgPT09ICdzb25nJykgewogICAgICAgICAgICBzcWwgPSAnc2VsZWN0IG51bWJlciwgbmFtZSBmcm9tIHNvbmcgd2hlcmUgMT0xJzsKICAgICAgICAgICAgaWYgKE1ZX0ZMLmxhbikgewogICAgICAgICAgICAgICAgcGFyYW1zLnB1c2goTVlfRkwubGFuKTsKICAgICAgICAgICAgICAgIHNxbCArPSAnIGFuZCBsYW5ndWFnZV9pZCA9ID8nOwogICAgICAgICAgICAgICAgLy8gX3VybCArPSAnJndoZXJlPWxhbmd1YWdlX2lkJmtleXdvcmRzPScgKyBNWV9GTC5sYW4gKyAnJnNpemU9MjEnOwogICAgICAgICAgICB9IGVsc2UgaWYgKE1ZX0ZMLnR5cGUpIHsKICAgICAgICAgICAgICAgIHBhcmFtcy5wdXNoKE1ZX0ZMLnR5cGUpOwogICAgICAgICAgICAgICAgc3FsICs9ICcgYW5kIHR5cGVfaWQgPSA/JzsKICAgICAgICAgICAgICAgIC8vIF91cmwgKz0gJyZ3aGVyZT10eXBlX2lkJmtleXdvcmRzPScgKyBNWV9GTC50eXBlICsgJyZzaXplPTIxJzsKICAgICAgICAgICAgfQogICAgICAgICAgICBzcWwgKz0gYCBvcmRlciBieSBudW1iZXIgbGltaXQgJHsocGcgLSAxKSAqIHNpemV9LCR7c2l6ZX07YDsKICAgICAgICAgICAgbGV0IGh0bWwgPSBwb3N0MihfdXJsLCB7cGFyYW1zOiBwYXJhbXMsIHNxbDogc3FsfSk7CiAgICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShodG1sKTsKICAgICAgICAgICAgZCA9IGpzb24ucmVzdWx0WzBdLnJlc3VsdHMubWFwKGl0ZW0gPT4gewogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICB2b2RfaWQ6IHJ1bGUubWt0dlVybCArIGl0ZW0ubnVtYmVyICsgJy5ta3YnICsgJ0BAJyArIGl0ZW0ubmFtZSArICdAQCcgKyAnJywKICAgICAgICAgICAgICAgICAgICB2b2RfbmFtZTogaXRlbS5uYW1lLAogICAgICAgICAgICAgICAgICAgIHZvZF9waWM6IHJ1bGUucGljLAogICAgICAgICAgICAgICAgICAgIHZvZF9yZW1hcmtzOiAnJywKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgfQogICAgICAgIFZPRFMgPSBkOwogICAgfSksCiAgICDkuoznuqc6ICRqcy50b1N0cmluZygoKSA9PiB7CiAgICAgICAgbGV0IF91cmwgPSBydWxlLnJvb3Q7CiAgICAgICAgbGV0IGlkID0gb3JJZC5zcGxpdCgnQEAnKVswXTsKICAgICAgICBsZXQgbmFtZSA9IG9ySWQuc3BsaXQoJ0BAJylbMV07CiAgICAgICAgaWYgKGlkLmVuZHNXaXRoKCcubWt2JykpIHsKICAgICAgICAgICAgVk9EID0gewogICAgICAgICAgICAgICAgdm9kX25hbWU6IG5hbWUsCiAgICAgICAgICAgICAgICB2b2RfcGxheV9mcm9tOiAn6YGT6ZW/5Zyo57q/JywKICAgICAgICAgICAgICAgIHZvZF9jb250ZW50OiAn6YGT6ZW/5Zyo57q/JywKICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIFZPRCA9IHsKICAgICAgICAgICAgICAgIHZvZF9uYW1lOiBpZCwKICAgICAgICAgICAgICAgIHZvZF9wbGF5X2Zyb206ICfpgZPplb/lnKjnur8nLAogICAgICAgICAgICAgICAgdm9kX2NvbnRlbnQ6ICfpgZPplb/lnKjnur8nLAogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChpZC5lbmRzV2l0aCgnLm1rdicpKSB7CiAgICAgICAgICAgIFZPRC52b2RfcGxheV91cmwgPSAn5ZeF5o6i5pKt5pS+JCcgKyBpZDsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBsZXQgcGFyYW1zID0gW2lkXTsKICAgICAgICAgICAgbGV0IHNxbCA9ICdzZWxlY3QgbnVtYmVyLG5hbWUgZnJvbSBzb25nIHdoZXJlIHNpbmdlcl9uYW1lcyA9ID8gb3JkZXIgYnkgbnVtYmVyIGxpbWl0IDAsOTk5JzsKICAgICAgICAgICAgbGV0IGh0bWwgPSBwb3N0MihfdXJsLCB7cGFyYW1zOiBwYXJhbXMsIHNxbDogc3FsfSk7CiAgICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShodG1sKTsKICAgICAgICAgICAgbGV0IGRhdGEgPSBqc29uLnJlc3VsdFswXS5yZXN1bHRzOwoKICAgICAgICAgICAgVk9ELnZvZF9wbGF5X3VybCA9IChkYXRhLm1hcChpdGVtID0+IHsKICAgICAgICAgICAgICAgIHJldHVybiBpdGVtLm5hbWUgKyAnJCcgKyBydWxlLm1rdHZVcmwgKyBpdGVtLm51bWJlciArICcubWt2JzsKICAgICAgICAgICAgfSkpLmpvaW4oJyMnKTsKICAgICAgICB9CiAgICB9KSwKICAgIOaQnOe0ojogJGpzLnRvU3RyaW5nKCgpID0+IHsKICAgICAgICBsZXQgX3VybCA9IHJ1bGUucm9vdDsKICAgICAgICBsZXQgd2QgPSBLRVk7CiAgICAgICAgbGV0IHNxbCA9ICJzZWxlY3QgbnVtYmVyLG5hbWUgZnJvbSBzb25nIHdoZXJlIG5hbWUgbGlrZSAnJSIgKyB3ZCArICIlJyBvciBzaW5nZXJfbmFtZXMgbGlrZSAnJSIgKyB3ZCArICIlJyI7CiAgICAgICAgbGV0IGQgPSBbXTsKICAgICAgICBsZXQgaHRtbCA9IHBvc3QyKF91cmwsIHtzcWw6IHNxbH0pOwogICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShodG1sKTsKICAgICAgICBkID0ganNvbi5yZXN1bHRbMF0ucmVzdWx0cy5tYXAoaXRlbSA9PiB7CiAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICB2b2RfaWQ6IHJ1bGUubWt0dlVybCArIGl0ZW0ubnVtYmVyICsgJy5ta3YnICsgJ0BAJyArIGl0ZW0ubmFtZSArICdAQCcgKyAnJywKICAgICAgICAgICAgICAgIHZvZF9uYW1lOiBpdGVtLm5hbWUsCiAgICAgICAgICAgICAgICB2b2RfcGljOiBydWxlLnBpYywKICAgICAgICAgICAgICAgIHZvZF9yZW1hcmtzOiBpdGVtLnNpbmdlcl9uYW1lcywKICAgICAgICAgICAgfQogICAgICAgIH0pOwogICAgICAgIFZPRFMgPSBkOwogICAgfSksCiAgICBwbGF5X3BhcnNlOiB0cnVlLAogICAgbGF6eTogJGpzLnRvU3RyaW5nKCgpID0+IHsKICAgICAgICBpbnB1dCA9IHtwYXJzZTogMCwgdXJsOiBpbnB1dH07CiAgICB9KSwKfQ==
|